﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using LCL.IBuilder;

namespace LCL.Tools.WinFrm.UserControls
{
    public partial class UcAddIns : UserControl
    {
        public UcAddIns()
        {
            InitializeComponent();
            this.BindlistView(this.listView1);
        }
        private void BindlistView(ListView lv)
        {
            #region listView1
            //创建列表
            this.listView1.Columns.Clear();
            this.listView1.Items.Clear();
            this.listView1.View = View.Details;
            this.listView1.GridLines = true;
            this.listView1.FullRowSelect = true;
            this.listView1.Columns.Add("名称", 80, HorizontalAlignment.Left);
            this.listView1.Columns.Add("版本", 80, HorizontalAlignment.Left);
            this.listView1.Columns.Add("程序集", 200, HorizontalAlignment.Left);
            #endregion

            var builder = new BuilderFactory();
            var _builderDescriptorList = builder.GetBuilderAll();
            foreach (var item in _builderDescriptorList)
            {
                string Name = item.Name;
                string Assembly = item.BuilderAssembly.GetName().Name;
                string Version = item.BuilderAssembly.AssemblyVersion().ToString();

                ListViewItem item1 = new ListViewItem(Name);
                item1.SubItems.Add(Version);
                item1.SubItems.Add(Assembly);
                this.listView1.Items.AddRange(new ListViewItem[] { item1 });
            }
        }
    }
}
